package com.test08.excelpoi04;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.google.gson.Gson;

import jxl.Sheet;
import jxl.Workbook;
import jxl.format.CellFormat;
import jxl.write.Boolean;
import jxl.write.DateFormats;
import jxl.write.DateTime;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCell;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

/*
 * 用来处理1.xls中的站点中信息的类
 * 
 */
public class ExcelTest03<V> {
	public static <E> void main(String[] args) throws Exception {
		// 构建Workbook对象, 只读Workbook对象
		InputStream instream = new FileInputStream("src/5.xls");
		Workbook readwb = Workbook.getWorkbook(instream);
		// 得到一个可写的副本及sheet
		WritableWorkbook writableWorkbook = Workbook.createWorkbook(new File("src/5.xls"), readwb);// 创建workbook的副本
		WritableSheet writableSheet = writableWorkbook.getSheet(0);
		
		
		WritableCell writableCell = writableSheet.getWritableCell(0, 0);
		// 写回去
		CellFormat cellFormat = writableCell.getCellFormat();
		Label label = new Label(0, 0, "4444");
		label.setCellFormat(cellFormat);
		writableSheet.addCell(label);
		
		writableCell = writableSheet.getWritableCell(1, 0);
		// 写回去
		cellFormat = writableCell.getCellFormat();
		label = new Label(1, 0, "4444");
		label.setCellFormat(cellFormat);
		writableSheet.addCell(label);
		
		
		writableWorkbook.write();
		writableWorkbook.close();// 关闭workbook，释放内存 ---》一定要释放内存
	}

}
